import React from "react";
import { Card, WingBlank, WhiteSpace } from 'antd-mobile';
import axios from "axios";

axios.defaults.baseURL = '/app'
axios.defaults.headers.post['Content-Type'] = 'application/json';
export default class CardWashList extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      data: props.data,
      category: props.category,
      code: props.code,
      modal: false,
      url: ''
    }
  }

  componentWillMount() {
    var url = "/memory/category/" + this.state.category + "/code/" + this.state.code;
    axios.get(url).then(res => {
      console.log(res.data.data);
      this.setState({
        data: res.data.data,
      });
    });
  }

  render() {
    console.log(this.state.data)
    if(this.state.data != '' && this.state.data != undefined){
      return (
        <div>
          {this.state.data.map((ii, index) => (
            <WingBlank size="lg">
              <WhiteSpace size="lg" />
              <Card>
                <Card.Header
                  title={ii.typeStr}
                  thumb={<img style={{width : '48px',height :'100%'}} src={ii.memo}></img>}
                  extra={ii.introduction}
                />
                <Card.Body>
                  <div>又洗{ii.typeStr}啦</div>
                </Card.Body>
                <Card.Footer content="洗床单时间" extra={<div>{ii.createDate}</div>} />
              </Card>
              <WhiteSpace size="lg" />
            </WingBlank>
          ))}
        </div>
      );
    }else{
      return (
        <div>
        </div>
      );
    }
  }
}

